package com.cainaer.orders.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cainaer.common.core.web.domain.AjaxResult;
import com.cainaer.orders.domain.OrderItem;
import com.cainaer.orders.mapper.OrderItemMapper;
import com.cainaer.orders.service.IOrderItemService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 订单商品信息表 前端控制器
 * </p>
 *
 * @author Tina
 * @since 2020-09-11
 */
@RestController
@RequestMapping("/orderItem/")
public class OrderItemController {

    private Logger logger= LoggerFactory.getLogger(OrderItemController.class);

    @Autowired
    private IOrderItemService orderItemService;

    @Autowired
    private OrderItemMapper ordersItemMapper;

    /**
     * 查询订单
     *
     * @param orderItem
     * @return
     */
    @GetMapping("list")
    public AjaxResult list(OrderItem orderItem) {
        return AjaxResult.success(ordersItemMapper.queryOrderItem());
    }

    /**
     * 通过商铺ID查询这个商铺的订单商铺信息的商品ID
     *
     * @param shopId 商铺ID
     * @return
     */
    @GetMapping("selectOrderItemProductIdListsByShopId")
    public List<Long> selectOrderItemProductIdListsByShopId(@RequestParam("shopId") Long shopId){
        return orderItemService.selectOrderItemProductIdListsByShopId(shopId);
    }


}
